import { hiprint } from 'vue-plugin-hiprint';
// 基础组件
const basicProvider = function() {
  return new hiprint.PrintElementTypeGroup('基础组件', [
    {
      tid: 'defaultModule.title',
      title: '标题',
      data: '',
      type: 'text',
      options: {
        height: 27,
        width: 259,
        title: '标题',
        fontSize: 19,
        fontWeight: '600',
        textAlign: 'center',
        lineHeight: 26,
        textContentVerticalAlign: 'middle'
      }
    },
    {
      tid: 'defaultModule.text',
      title: '文本',
      data: '',
      type: 'text'
    },
    {
      tid: 'defaultModule.image',
      title: '系统logo',
      type: 'image',
      options: {
        src: 'http://his.gaozhentang.com:9008/static/img/logo_mini.288696e7.png'
      }
    },
    {
      tid: 'defaultModule.longText',
      title: '长文本',
      data: '',
      type: 'longText'
    },
    {
      tid: 'defaultModule.customText',
      title: '自定义文本',
      customText: '自定义文本',
      custom: true,
      type: 'text'
    },
    {
      tid: 'defaultModule.hline',
      title: '横线',
      type: 'hline'
    },
    {
      tid: 'defaultModule.vline',
      title: '竖线',
      type: 'vline'
    },
    {
      tid: 'defaultModule.rect',
      title: '矩形',
      type: 'rect'
    },
    {
      tid: 'defaultModule.oval',
      title: '椭圆',
      type: 'oval'
    }

  ]);
};
// 系统组件
const systemProvider = function() {
  return new hiprint.PrintElementTypeGroup('系统组件', [
    {
      tid: 'defaultModule.createName',
      title: '创建人',
      field: 'createName',
      type: 'text',
      options: {
        field: 'createName',
        testData: '创建人',
        height: 16,
        fontSize: 6.75,
        fontWeight: '700',
        textAlign: 'left',
        textContentVerticalAlign: 'middle'
      }
    },
    {
      tid: 'defaultModule.createBy',
      title: '操作人',
      field: 'createBy',
      type: 'text',
      options: {
        field: 'createBy',
        testData: '操作人',
        height: 16,
        fontSize: 6.75,
        fontWeight: '700',
        textAlign: 'left',
        textContentVerticalAlign: 'middle'
      }
    },
    {
      tid: 'defaultModule.logo',
      title: '系统logo',
      data: 'http://his.gaozhentang.com:9008/static/img/logo_mini.288696e7.png',
      type: 'image',
      options: {
        src: 'http://his.gaozhentang.com:9008/static/img/logo_mini.288696e7.png'
      }
    },
    {
      tid: 'defaultModule.currentDate',
      title: '当前日期',
      field: 'currentDate',
      type: 'text',
      options: {
        field: 'currentDate',
        testData: '当前日期',
        height: 16,
        fontSize: 6.75,
        fontWeight: '700',
        textAlign: 'center',
        hideTitle: true
      }
    },
    {
      tid: 'defaultModule.currentTime',
      title: '当前时间',
      field: 'currentTime',
      type: 'text',
      options: {
        field: 'currentTime',
        testData: '当前时间',
        height: 16,
        fontSize: 6.75,
        fontWeight: '700',
        textAlign: 'center',
        hideTitle: true
      }
    }
  ]);
};
// 挂号125
const register = [
  {
    tid: 'defaultModule.patientName',
    title: '姓名',
    data: '张三',
    type: 'text',
    options: {
      field: 'patientName',
      testData: '张三',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.sexName',
    title: '性别',
    data: '男',
    type: 'text',
    options: {
      field: 'sexName',
      testData: '男',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.idNumber',
    title: '证件号',
    data: '123456789',
    type: 'text',
    options: {
      field: 'idNumber',
      testData: '410182********5317',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.orderNo',
    title: '挂号单号',
    data: '123456789',
    type: 'text',
    options: {
      field: 'orderNo',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'taskProviderModule.id', title: '二维码', data: 'XS888888888', type: 'text',
    options: {
      field: 'id',
      testData: 'XS888888888',
      height: 32,
      fontSize: 12,
      lineHeight: 18,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle',
      textType: 'qrcode'
    }
  },
  {
    tid: 'defaultModule.cashierId',
    title: '创建人ID',
    data: '123456789',
    type: 'text',
    options: {
      field: 'cashierId',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.appointmentDate',
    title: '挂号日期',
    data: '123456789',
    type: 'text',
    options: {
      field: 'appointmentDate',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  }
];
// 理疗160
const therapyPlan = [
];
// 审核调剂(煎药卡)286
const examine = [
  {
    tid: 'defaultModule.city',
    title: '归  属  地',
    data: '',
    type: 'text',
    options: {
      field: 'city',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.yardName',
    title: '部    门',
    data: '',
    type: 'text',
    options: {
      field: 'yardName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.patientName',
    title: '姓名',
    data: '',
    type: 'text',
    options: {
      field: 'patientName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.phone',
    title: '手机号',
    data: '',
    type: 'text',
    options: {
      field: 'phone',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.idNumber',
    title: '证件号',
    data: '',
    type: 'text',
    options: {
      field: 'idNumber',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.medicamentTypeName',
    title: '剂型',
    data: '',
    type: 'text',
    options: {
      field: 'medicamentTypeName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.drugNum',
    title: '数量',
    data: '',
    type: 'text',
    options: {
      field: 'drugNum',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.total',
    title: '总克数',
    data: '',
    type: 'text',
    options: {
      field: 'total',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.ointmentMakerName',
    title: '调剂师',
    data: '',
    type: 'text',
    options: {
      field: 'ointmentMakerName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.printTime',
    title: '打印时间',
    field: 'printTime',
    type: 'text',
    options: {
      field: 'printTime',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'center'
    }
  }
];
// 医养签收288
const signFor = [
  {
    tid: 'defaultModule.patientName',
    title: '姓名',
    data: '',
    type: 'text',
    options: {
      field: 'patientName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.medicamentTypeName',
    title: '剂型',
    data: '',
    type: 'text',
    options: {
      field: 'medicamentTypeName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.drugNum',
    title: '领取数量',
    data: 'drugNum',
    type: 'text',
    options: {
      field: '',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.tex',
    title: '领取人签字',
    data: '',
    type: 'text',
    options: {
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.date',
    title: '领取日期',
    data: '',
    type: 'text',
    options: {
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.sendExpressName',
    title: '快递公司',
    data: '',
    type: 'text',
    options: {
      field: 'sendExpressName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.sendExpressOrderNo',
    title: '快递单号',
    data: '',
    type: 'text',
    options: {
      field: 'sendExpressOrderNo',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  }
];
// 看诊\订购 284、285
const see = [
  {
    tid: 'defaultModule.patientName',
    title: '姓名',
    data: '',
    type: 'text',
    options: {
      field: 'patientName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.patientSex',
    title: '性别',
    data: '',
    type: 'text',
    options: {
      field: 'patientSex',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.patientAge',
    title: '年龄',
    data: '',
    type: 'text',
    options: {
      field: 'patientAge',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.preliminaryDiagnosis',
    title: '临床诊断',
    data: '',
    type: 'text',
    options: {
      field: 'preliminaryDiagnosis',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.orderDetail',
    title: '处方明细',
    data: '',
    type: 'longText',
    options: {
      field: 'orderDetail',
      testData: '',
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle',
      hideTitle: true
    }
  },
  {
    tid: 'defaultModule.createTime',
    title: '日期',
    data: '',
    type: 'text',
    options: {
      field: 'createTime',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.followUpDoctor',
    title: '医师',
    data: '',
    type: 'text',
    options: {
      field: 'followUpDoctor',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.',
    title: '审核',
    data: '',
    type: 'text',
    options: {
      field: '',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.',
    title: '核对',
    data: '',
    type: 'text',
    options: {
      field: '',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.chemistName',
    title: '调配',
    data: '',
    type: 'text',
    options: {
      field: 'chemistName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.chemistName',
    title: '发药',
    data: '',
    type: 'text',
    options: {
      field: 'chemistName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.goodsAmount',
    title: '药费',
    data: '',
    type: 'text',
    options: {
      field: 'goodsAmount',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.processingFee',
    title: '加工费',
    data: '',
    type: 'text',
    options: {
      field: 'processingFee',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.totalPrice',
    title: '合计',
    data: '',
    type: 'text',
    options: {
      field: 'totalPrice',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  }
];
// 分拣发货（配送卡）287
const delivery = [
  {
    tid: 'defaultModule.city',
    title: '归属地',
    data: '',
    type: 'text',
    options: {
      field: 'patientName',
      testData: 'city',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.yardName',
    title: '部门',
    data: '',
    type: 'text',
    options: {
      field: 'yardName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.patientName',
    title: '姓名',
    data: '',
    type: 'text',
    options: {
      field: 'patientName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.phone',
    title: '手机号',
    data: '',
    type: 'text',
    options: {
      field: 'phone',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.idNumber',
    title: '证件号',
    data: '',
    type: 'text',
    options: {
      field: 'idNumber',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.medicamentTypeName',
    title: '剂型',
    data: '',
    type: 'text',
    options: {
      field: 'medicamentTypeName',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.receiveNum',
    title: '数量',
    data: '',
    type: 'text',
    options: {
      field: 'receiveNum',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  },
  {
    tid: 'defaultModule.usage',
    title: '用法用量',
    data: '',
    type: 'text',
    options: {
      field: 'usage',
      testData: '',
      height: 16,
      fontSize: 6.75,
      fontWeight: '700',
      textAlign: 'left',
      textContentVerticalAlign: 'middle'
    }
  }
];
// 自定义业务组件
const customProvider = (providerArr) => {
  return new hiprint.PrintElementTypeGroup('业务组件', providerArr);
};
  // 可拖拽打印元素组件
export const customPrintElementProvider = function(providerArr) {
  var addElementTypes = function(context) {
    context.removePrintElementTypes('taskProviderModule');
    context.addPrintElementTypes('taskProviderModule', [
      basicProvider(),
      customProvider(
        providerArr == 125 ? register : providerArr == 160 ? therapyPlan : providerArr == 286 ? examine : providerArr == 288 ? signFor : providerArr == 284 ? see : providerArr == 285 ? see : providerArr == 287 ? delivery : [
              {
                tid: 'defaultModule.text',
                title: '文本',
                data: '',
                type: 'text'
              }
            ]
      )
      // systemProvider()
    ]);
  };
  return {
    addElementTypes: addElementTypes
  };
};
export default customPrintElementProvider;
